package com.mt.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.google.common.collect.Maps;
import com.mt.channel.entity.ChannelCourseEntity;
import com.mt.channel.feign.ChannelCourseFeign;
import com.mt.common.PagerInfo;
import com.mt.common.ServiceResult;

@Controller
@RequestMapping("/channelAdminCourser")
public class ChannelCourseController {

    @Autowired
    ChannelCourseFeign channelCourseFeign;

    @GetMapping("/findList")
    public ResponseEntity<Map<String, Object>> findList(HttpServletRequest request, HttpServletResponse response) {
        // 查询用户权限
        // 保存用户token
        Map<String, Object> result = Maps.newHashMap();
        Map<String, Object> params = null;
        PagerInfo<?> pagerInfo = null;
        params = new HashMap<>();
        params.put("channelId", 1);
        ServiceResult<List<ChannelCourseEntity>> list = channelCourseFeign.findList(params);

        result.put("count", 0);
        result.put("code", 0);
        result.put("data", list.getResult());

        return new ResponseEntity<Map<String, Object>>(result, HttpStatus.OK);
    }
}
